<?php
/**
 * Created by PhpStorm.
 * User: waw
 * Date: 2019/6/21
 * Time: 23:04
 */
if($_SERVER["REQUEST_METHOD"]=="GET"){
    print_r(json_encode(array("msg"=>"不能使用get","status"=>4)));
    return;
}
session_start();
if(!isset($_SESSION["registor"])){
    print_r(json_encode(array("msg"=>"请登录","status"=>3)));
    return;
}
$cid=$_REQUEST["cid"];
$p_number=$_REQUEST["num"];

include "./DBhelper.php";
$update="UPDATE `cartlists` SET `g_num`='".$p_number."',`g_total`=`g_num`*`g_preis` WHERE `c_id`='".$cid."'";
$uResult=sqlQuery($update);
if($uResult==1){
    print_r(json_encode(array("msg"=>"alreadyChange","status"=>1)));
}else{
    print_r(json_encode(array("msg"=>"changed","status"=>2)));
}